package com.lancoo.ccas53.pojo.response.basicPlatform;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.lancoo.ccas53.entity.PeriodScheme;
import com.lancoo.ccas53.entity.Student;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalTime;

/**
 * @ClassName BasePeriodScheme
 * @Description TODO
 * @Author quin
 * @Date 2024/5/21 9:57
 */
@NoArgsConstructor
@Data
public class BasePeriodScheme {

    @JsonProperty("SchoolID")
    private String schoolID;
    @JsonProperty("ClassHourType")
    private Integer classHourType;
    @JsonProperty("ClassHourNO")
    private Integer classHourNO;
    @JsonProperty("ClassHourName")
    private String classHourName;
    @JsonProperty("StartDate")
    private String startDate;
    @JsonProperty("EndDate")
    private String endDate;
    @JsonProperty("PeriodID")
    private String periodID;
    @JsonProperty("SchemeID")
    private String schemeID;
    @JsonProperty("SchemeName")
    private String schemeName;

    public PeriodScheme toPeriodScheme(Integer taskId){
        return new PeriodScheme()
                .setTaskId(taskId)
                .setBaseSchemeId(getSchemeID())
                .setBaseSchemeName(getSchemeName())
                .setPeriod(getClassHourNO())
                .setPeriodName(getClassHourName())
                .setPeriodType(getClassHourType())
                .setStartTime(LocalTime.parse(getStartDate()))
                .setEndTime(LocalTime.parse(getEndDate()));
    }

}
